\(\int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx\) [1072]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 28, antiderivative size = 116 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=2 a^2 (c-i d)^2 x-\frac {2 i a^2 (c-i d)^2 \log (\cos (e+f x))}{f}-\frac {a^2 (c-i d)^2 \tan (e+f x)}{f}+\frac {c d (a+i a \tan (e+f x))^2}{f}-\frac {i d^2 (a+i a \tan (e+f x))^3}{3 a f} \]

[Out]

2*a^2*(c-I*d)^2*x-2*I*a^2*(c-I*d)^2*ln(cos(f*x+e))/f-a^2*(c-I*d)^2*tan(f*x+e)/f+c*d*(a+I*a*tan(f*x+e))^2/f-1/3
*I*d^2*(a+I*a*tan(f*x+e))^3/a/f

Rubi [A] (verified)

Time = 0.19 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3624, 3608, 3558, 3556} \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=-\frac {a^2 (c-i d)^2 \tan (e+f x)}{f}-\frac {2 i a^2 (c-i d)^2 \log (\cos (e+f x))}{f}+2 a^2 x (c-i d)^2+\frac {c d (a+i a \tan (e+f x))^2}{f}-\frac {i d^2 (a+i a \tan (e+f x))^3}{3 a f} \]

[In]

Int[(a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^2,x]

[Out]

2*a^2*(c - I*d)^2*x - ((2*I)*a^2*(c - I*d)^2*Log[Cos[e + f*x]])/f - (a^2*(c - I*d)^2*Tan[e + f*x])/f + (c*d*(a
 + I*a*Tan[e + f*x])^2)/f - ((I/3)*d^2*(a + I*a*Tan[e + f*x])^3)/(a*f)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3558

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[b^2*(Tan[c + d*x]/d), x]) /; FreeQ[{a, b, c, d}, x]

Rule 3608

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*(
(a + b*Tan[e + f*x])^m/(f*m)), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rule 3624

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rubi steps \begin{align*} \text {integral}& = -\frac {i d^2 (a+i a \tan (e+f x))^3}{3 a f}+\int (a+i a \tan (e+f x))^2 \left (c^2-d^2+2 c d \tan (e+f x)\right ) \, dx \\ & = \frac {c d (a+i a \tan (e+f x))^2}{f}-\frac {i d^2 (a+i a \tan (e+f x))^3}{3 a f}+(c-i d)^2 \int (a+i a \tan (e+f x))^2 \, dx \\ & = 2 a^2 (c-i d)^2 x-\frac {a^2 (c-i d)^2 \tan (e+f x)}{f}+\frac {c d (a+i a \tan (e+f x))^2}{f}-\frac {i d^2 (a+i a \tan (e+f x))^3}{3 a f}+\left (2 i a^2 (c-i d)^2\right ) \int \tan (e+f x) \, dx \\ & = 2 a^2 (c-i d)^2 x-\frac {2 i a^2 (c-i d)^2 \log (\cos (e+f x))}{f}-\frac {a^2 (c-i d)^2 \tan (e+f x)}{f}+\frac {c d (a+i a \tan (e+f x))^2}{f}-\frac {i d^2 (a+i a \tan (e+f x))^3}{3 a f} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.19 (sec) , antiderivative size = 100, normalized size of antiderivative = 0.86 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=\frac {a^2 \left ((3 c-i d) d+6 i (c-i d)^2 \log (i+\tan (e+f x))-3 \left (c^2-4 i c d-2 d^2\right ) \tan (e+f x)-3 (c-i d) d \tan ^2(e+f x)-d^2 \tan ^3(e+f x)\right )}{3 f} \]

[In]

Integrate[(a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^2,x]

[Out]

(a^2*((3*c - I*d)*d + (6*I)*(c - I*d)^2*Log[I + Tan[e + f*x]] - 3*(c^2 - (4*I)*c*d - 2*d^2)*Tan[e + f*x] - 3*(
c - I*d)*d*Tan[e + f*x]^2 - d^2*Tan[e + f*x]^3))/(3*f)

Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 135, normalized size of antiderivative = 1.16

method result size
derivativedivides \(\frac {a^{2} \left (i d^{2} \left (\tan ^{2}\left (f x +e \right )\right )-\frac {d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3}+4 i c d \tan \left (f x +e \right )-c d \left (\tan ^{2}\left (f x +e \right )\right )-c^{2} \tan \left (f x +e \right )+2 d^{2} \tan \left (f x +e \right )+\frac {\left (2 i c^{2}-2 i d^{2}+4 c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-4 i c d +2 c^{2}-2 d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(135\)
default \(\frac {a^{2} \left (i d^{2} \left (\tan ^{2}\left (f x +e \right )\right )-\frac {d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3}+4 i c d \tan \left (f x +e \right )-c d \left (\tan ^{2}\left (f x +e \right )\right )-c^{2} \tan \left (f x +e \right )+2 d^{2} \tan \left (f x +e \right )+\frac {\left (2 i c^{2}-2 i d^{2}+4 c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-4 i c d +2 c^{2}-2 d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(135\)
norman \(\left (-4 i a^{2} c d +2 a^{2} c^{2}-2 a^{2} d^{2}\right ) x -\frac {\left (-i a^{2} d^{2}+a^{2} c d \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{f}-\frac {\left (-4 i a^{2} c d +a^{2} c^{2}-2 a^{2} d^{2}\right ) \tan \left (f x +e \right )}{f}-\frac {a^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {i a^{2} \left (-2 i c d +c^{2}-d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f}\) \(146\)
parts \(a^{2} c^{2} x +\frac {\left (2 i a^{2} c^{2}+2 a^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {\left (2 i a^{2} d^{2}-2 a^{2} c d \right ) \left (\frac {\left (\tan ^{2}\left (f x +e \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}\right )}{f}+\frac {\left (4 i a^{2} c d -a^{2} c^{2}+a^{2} d^{2}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}-\frac {a^{2} d^{2} \left (\frac {\left (\tan ^{3}\left (f x +e \right )\right )}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(169\)
parallelrisch \(\frac {-12 i x \,a^{2} c d f +3 i \left (\tan ^{2}\left (f x +e \right )\right ) a^{2} d^{2}-a^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )+3 i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c^{2}-3 i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} d^{2}+12 i \tan \left (f x +e \right ) a^{2} c d +6 x \,a^{2} c^{2} f -6 x \,a^{2} d^{2} f -3 \left (\tan ^{2}\left (f x +e \right )\right ) a^{2} c d +6 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c d -3 \tan \left (f x +e \right ) a^{2} c^{2}+6 \tan \left (f x +e \right ) a^{2} d^{2}}{3 f}\) \(185\)
risch \(\frac {8 i a^{2} c d e}{f}-\frac {4 a^{2} c^{2} e}{f}+\frac {4 a^{2} d^{2} e}{f}-\frac {2 i a^{2} \left (3 c^{2} {\mathrm e}^{4 i \left (f x +e \right )}-15 d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-18 i c d \,{\mathrm e}^{4 i \left (f x +e \right )}+6 c^{2} {\mathrm e}^{2 i \left (f x +e \right )}-18 d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-30 i c d \,{\mathrm e}^{2 i \left (f x +e \right )}+3 c^{2}-7 d^{2}-12 i c d \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}-\frac {4 a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c d}{f}-\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{2}}{f}+\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d^{2}}{f}\) \(230\)

[In]

int((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/f*a^2*(I*d^2*tan(f*x+e)^2-1/3*d^2*tan(f*x+e)^3+4*I*c*d*tan(f*x+e)-c*d*tan(f*x+e)^2-c^2*tan(f*x+e)+2*d^2*tan(
f*x+e)+1/2*(4*c*d-2*I*d^2+2*I*c^2)*ln(1+tan(f*x+e)^2)+(-2*d^2+2*c^2-4*I*c*d)*arctan(tan(f*x+e)))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 277 vs. \(2 (100) = 200\).

Time = 0.24 (sec) , antiderivative size = 277, normalized size of antiderivative = 2.39 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=-\frac {2 \, {\left (3 i \, a^{2} c^{2} + 12 \, a^{2} c d - 7 i \, a^{2} d^{2} + 3 \, {\left (i \, a^{2} c^{2} + 6 \, a^{2} c d - 5 i \, a^{2} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 6 \, {\left (i \, a^{2} c^{2} + 5 \, a^{2} c d - 3 i \, a^{2} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + 3 \, {\left (i \, a^{2} c^{2} + 2 \, a^{2} c d - i \, a^{2} d^{2} + {\left (i \, a^{2} c^{2} + 2 \, a^{2} c d - i \, a^{2} d^{2}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, {\left (i \, a^{2} c^{2} + 2 \, a^{2} c d - i \, a^{2} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, {\left (i \, a^{2} c^{2} + 2 \, a^{2} c d - i \, a^{2} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{3 \, {\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \]

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

-2/3*(3*I*a^2*c^2 + 12*a^2*c*d - 7*I*a^2*d^2 + 3*(I*a^2*c^2 + 6*a^2*c*d - 5*I*a^2*d^2)*e^(4*I*f*x + 4*I*e) + 6
*(I*a^2*c^2 + 5*a^2*c*d - 3*I*a^2*d^2)*e^(2*I*f*x + 2*I*e) + 3*(I*a^2*c^2 + 2*a^2*c*d - I*a^2*d^2 + (I*a^2*c^2
 + 2*a^2*c*d - I*a^2*d^2)*e^(6*I*f*x + 6*I*e) + 3*(I*a^2*c^2 + 2*a^2*c*d - I*a^2*d^2)*e^(4*I*f*x + 4*I*e) + 3*
(I*a^2*c^2 + 2*a^2*c*d - I*a^2*d^2)*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2*I*e) + 1))/(f*e^(6*I*f*x + 6*I*e)
+ 3*f*e^(4*I*f*x + 4*I*e) + 3*f*e^(2*I*f*x + 2*I*e) + f)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 236 vs. \(2 (97) = 194\).

Time = 0.42 (sec) , antiderivative size = 236, normalized size of antiderivative = 2.03 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=- \frac {2 i a^{2} \left (c - i d\right )^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 6 i a^{2} c^{2} - 24 a^{2} c d + 14 i a^{2} d^{2} + \left (- 12 i a^{2} c^{2} e^{2 i e} - 60 a^{2} c d e^{2 i e} + 36 i a^{2} d^{2} e^{2 i e}\right ) e^{2 i f x} + \left (- 6 i a^{2} c^{2} e^{4 i e} - 36 a^{2} c d e^{4 i e} + 30 i a^{2} d^{2} e^{4 i e}\right ) e^{4 i f x}}{3 f e^{6 i e} e^{6 i f x} + 9 f e^{4 i e} e^{4 i f x} + 9 f e^{2 i e} e^{2 i f x} + 3 f} \]

[In]

integrate((a+I*a*tan(f*x+e))**2*(c+d*tan(f*x+e))**2,x)

[Out]

-2*I*a**2*(c - I*d)**2*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-6*I*a**2*c**2 - 24*a**2*c*d + 14*I*a**2*d**2 + (-
12*I*a**2*c**2*exp(2*I*e) - 60*a**2*c*d*exp(2*I*e) + 36*I*a**2*d**2*exp(2*I*e))*exp(2*I*f*x) + (-6*I*a**2*c**2
*exp(4*I*e) - 36*a**2*c*d*exp(4*I*e) + 30*I*a**2*d**2*exp(4*I*e))*exp(4*I*f*x))/(3*f*exp(6*I*e)*exp(6*I*f*x) +
 9*f*exp(4*I*e)*exp(4*I*f*x) + 9*f*exp(2*I*e)*exp(2*I*f*x) + 3*f)

Maxima [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 144, normalized size of antiderivative = 1.24 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=-\frac {a^{2} d^{2} \tan \left (f x + e\right )^{3} + 3 \, {\left (a^{2} c d - i \, a^{2} d^{2}\right )} \tan \left (f x + e\right )^{2} - 6 \, {\left (a^{2} c^{2} - 2 i \, a^{2} c d - a^{2} d^{2}\right )} {\left (f x + e\right )} - 3 \, {\left (i \, a^{2} c^{2} + 2 \, a^{2} c d - i \, a^{2} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 3 \, {\left (a^{2} c^{2} - 4 i \, a^{2} c d - 2 \, a^{2} d^{2}\right )} \tan \left (f x + e\right )}{3 \, f} \]

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

-1/3*(a^2*d^2*tan(f*x + e)^3 + 3*(a^2*c*d - I*a^2*d^2)*tan(f*x + e)^2 - 6*(a^2*c^2 - 2*I*a^2*c*d - a^2*d^2)*(f
*x + e) - 3*(I*a^2*c^2 + 2*a^2*c*d - I*a^2*d^2)*log(tan(f*x + e)^2 + 1) + 3*(a^2*c^2 - 4*I*a^2*c*d - 2*a^2*d^2
)*tan(f*x + e))/f

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 482 vs. \(2 (100) = 200\).

Time = 0.57 (sec) , antiderivative size = 482, normalized size of antiderivative = 4.16 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=-\frac {2 \, {\left (3 i \, a^{2} c^{2} e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 6 \, a^{2} c d e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 3 i \, a^{2} d^{2} e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 9 i \, a^{2} c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 18 \, a^{2} c d e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 9 i \, a^{2} d^{2} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 9 i \, a^{2} c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 18 \, a^{2} c d e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 9 i \, a^{2} d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 3 i \, a^{2} c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 18 \, a^{2} c d e^{\left (4 i \, f x + 4 i \, e\right )} - 15 i \, a^{2} d^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 6 i \, a^{2} c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 30 \, a^{2} c d e^{\left (2 i \, f x + 2 i \, e\right )} - 18 i \, a^{2} d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 3 i \, a^{2} c^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 6 \, a^{2} c d \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 3 i \, a^{2} d^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 3 i \, a^{2} c^{2} + 12 \, a^{2} c d - 7 i \, a^{2} d^{2}\right )}}{3 \, {\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \]

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x, algorithm="giac")

[Out]

-2/3*(3*I*a^2*c^2*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 6*a^2*c*d*e^(6*I*f*x + 6*I*e)*log(e^(2*I*
f*x + 2*I*e) + 1) - 3*I*a^2*d^2*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 9*I*a^2*c^2*e^(4*I*f*x + 4*
I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 18*a^2*c*d*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 9*I*a^2*d^2*
e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 9*I*a^2*c^2*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1
) + 18*a^2*c*d*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 9*I*a^2*d^2*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f
*x + 2*I*e) + 1) + 3*I*a^2*c^2*e^(4*I*f*x + 4*I*e) + 18*a^2*c*d*e^(4*I*f*x + 4*I*e) - 15*I*a^2*d^2*e^(4*I*f*x
+ 4*I*e) + 6*I*a^2*c^2*e^(2*I*f*x + 2*I*e) + 30*a^2*c*d*e^(2*I*f*x + 2*I*e) - 18*I*a^2*d^2*e^(2*I*f*x + 2*I*e)
 + 3*I*a^2*c^2*log(e^(2*I*f*x + 2*I*e) + 1) + 6*a^2*c*d*log(e^(2*I*f*x + 2*I*e) + 1) - 3*I*a^2*d^2*log(e^(2*I*
f*x + 2*I*e) + 1) + 3*I*a^2*c^2 + 12*a^2*c*d - 7*I*a^2*d^2)/(f*e^(6*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x + 4*I*e) +
 3*f*e^(2*I*f*x + 2*I*e) + f)

Mupad [B] (verification not implemented)

Time = 6.02 (sec) , antiderivative size = 139, normalized size of antiderivative = 1.20 \[ \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {a^2\,d^2\,1{}\mathrm {i}}{2}+\frac {a^2\,d\,\left (d+c\,2{}\mathrm {i}\right )\,1{}\mathrm {i}}{2}\right )}{f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,d^2+a^2\,d\,\left (d+c\,2{}\mathrm {i}\right )+a^2\,c\,\left (2\,d+c\,1{}\mathrm {i}\right )\,1{}\mathrm {i}\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a^2\,c^2\,2{}\mathrm {i}+4\,a^2\,c\,d-a^2\,d^2\,2{}\mathrm {i}\right )}{f}-\frac {a^2\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f} \]

[In]

int((a + a*tan(e + f*x)*1i)^2*(c + d*tan(e + f*x))^2,x)

[Out]

(tan(e + f*x)^2*((a^2*d^2*1i)/2 + (a^2*d*(c*2i + d)*1i)/2))/f + (tan(e + f*x)*(a^2*d^2 + a^2*d*(c*2i + d) + a^
2*c*(c*1i + 2*d)*1i))/f + (log(tan(e + f*x) + 1i)*(a^2*c^2*2i - a^2*d^2*2i + 4*a^2*c*d))/f - (a^2*d^2*tan(e +
f*x)^3)/(3*f)